package com.czmh.etc.onlinepubsys.controller;

import com.czmh.etc.onlinepubsys.json.JsonResult;
import com.czmh.etc.onlinepubsys.services.EtcUserInfoSevice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 
 * @描述： 
 * @author： Seven.
 * @创建日期：Nov 13, 2019 7:35:42 PM. 
 * @版本：1.0.0
 */
@RestController
@RequestMapping("/{version}/")
@Api(tags = "微信控制器")
public class WxAuthorizeController {
    @Autowired
    private EtcUserInfoSevice             etcUserInfoSevice;
    
    @GetMapping(value = "connect/oauth2/authorize")
    @ApiOperation(value = "微信授权", notes = "微信授权")
    public JsonResult authorize(@ApiParam("微信授权code") @RequestParam String code,
                                HttpServletRequest request, HttpServletResponse response) throws Exception {
        return etcUserInfoSevice.saveUserInfoByCode(code);
    }
}